#ifndef EXECUTIONENGINE_H
#define EXECUTIONENGINE_H

#include "crossbit/common.h"
#include "crossbit/MemoryImage.h"
#include "crossbit/MemoryManager.h"
#include "crossbit/TraceManager.h"
#include "crossbit/Interpreter.h"
#include "crossbit/Translator.h"
#include "crossbit/TBlock.h"
#include "crossbit/TCache.h"
#include "crossbit/VBlockBuilder.h"
#include "crossbit/VFilter.h"
#include "crossbit/SyscallHandler.h"
#include "crossbit/ProcessorState.h"
#include "crossbit/ShadowPage.h"

///Begin/////Added by Gujh for RaceBit
#include "crossbit/RBThread.h"
///End//////Added by Gujh for RaceBit

//#include "crossbit/Smc.h"

namespace crossbit {

		class ExecutionEngine {
				public:
						ExecutionEngine(MemoryImage 	*memory_image, 
										MemoryManager	*memory_manager,
										TraceManager	*trace_manager,
										Interpreter 	*interpreter, 
										VBlockBuilder 	*builder, 
										TCache 			*tcache,
										Translator 		*translator,
										SyscallHandler	*syscall_handler,
										ProcessorState	*processor_state,
										ShadowPage		*shadow_page)
								:	ee_memory_image(memory_image),
								ee_memory_manager(memory_manager),
								ee_trace_manager(trace_manager),
								ee_interpreter(interpreter),
								ee_builder(builder),
								ee_tcache(tcache),
								ee_translator(translator),
								ee_syscall_handler(syscall_handler),
								ee_processor_state(processor_state),
								ee_shadow_page(shadow_page)
								{
										ee_memory_image->load();
										ee_interpreter->initStack( ee_memory_image->stack() );
								}

						~ExecutionEngine()
						{
						}

						void run( XTMemAddr addr );


				protected:
						// major components of CrossBit
						MemoryImage	    * ee_memory_image;
						MemoryManager   * ee_memory_manager;
						TraceManager	* ee_trace_manager;
						Interpreter	    * ee_interpreter;
						Translator	    * ee_translator;
						VBlockBuilder	* ee_builder;
						TCache	    	* ee_tcache;
						SyscallHandler  * ee_syscall_handler;
						ProcessorState	* ee_processor_state;
						ShadowPage		* ee_shadow_page;


		};

}

#endif
